package com.atguigu.gmall.item.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.service.SkuDetailService;
import com.atguigu.gmall.item.vo.SkuDetailVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lfy
 * @Description
 * @create 2022-11-02 11:52
 */
@Slf4j
@RequestMapping("/api/inner/rpc/item")
@RestController
public class SkuDetailRpcController {

    @Autowired
    SkuDetailService skuDetailService;


    @GetMapping("/sku/detail/{skuId}")
    public Result<SkuDetailVo> getSkuDetail(@PathVariable("skuId") Long skuId) {

        SkuDetailVo skuDetailVo = skuDetailService.getDetail(skuId);
        return Result.ok(skuDetailVo);
    }
}

